Source code compiler using natural language input

ABSTRACT

A system includes a source code repository which stores source code entries, which include instructions in a programming language for performing computing tasks. A code generator receives an input which includes a request to perform a first computing task. Keywords, including a variable-associated keyword and a function-related keyword, are identified in the input. Code-line entries are determined which, when executed in an ordered combination, achieve the first computing task. Based on the variable-associated keyword, variables appearing in the source code repository are determined to declare in order to perform the first computing task. Based on the function-related keyword, functions appearing in the source code repository are determined to define and call to perform the first computing task. A custom code is generated, in the programming language.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/793,219 filed Feb. 18, 2020, by Vidhya Vaithiyanathan, and entitled“SOURCE CODE COMPILER USING NATURAL LANGUAGE INPUT,” which isincorporated herein by reference.

TECHNICAL FIELD

The present disclosure relates generally to establishing and maintainingsource code. More particularly, in certain embodiments, the presentdisclosure is related to a source code compiler using natural languageinput.

BACKGROUND

Source code is programming code presented in a human-readableprogramming language (e.g., as opposed to binary machine code). A givenprogram, or computing task, may be implemented using source code.Specialized training and knowledge of a source code's programminglanguage is generally required to both understand the function(s) of agiven piece of source code and to create new code using the source codeas a starting point to perform a desired task.

SUMMARY

In an embodiment, a system includes a source code repository configuredto store source code entries created by a plurality of users. Eachsource code entry includes instructions in a programming language forperforming a computing task. A style repository is configured to store astyle profile for each of the plurality of users. Each style profileincludes predefined style features associated with formattingcharacteristics of the stored source code entries for a correspondinguser. A source code analyzer is communicatively coupled to the sourcecode repository and the style repository. A processor of the source codeanalyzer receives, from a first user, a first source code which includesinstructions in the programming language for performing a firstcomputing task. First style features of the first source code aredetermined. The first style features include characteristics of a formatof the first source code. The processor determines whether the firststyle features correspond to first predefined style features indicatedby a first style profile associated with the first user. In response todetermining that this is the case, the source code is stored in thesource code repository. In response to determining that this is not thecase, storage of the first source code in the source code repository isprevented.

In yet another embodiment, a system includes a source code repositorywhich stores source code entries, which include instructions in aprogramming language for performing computing tasks. A code generatorreceives, from a user, an input which includes a request in a naturallanguage to perform a first computing task. Keywords are identified inthe input. The keywords include a variable-associated keyword and afunction-related keyword. Based on the identified keywords, code-lineentries are determined which, when executed in an ordered combination,achieve the first computing task. The code-line entries include avariable-declaration entry, a function-definition entry, and afunction-call entry. Based on the variable-associated keyword, one ormore variables appearing in the source code repository are determined todeclare in order to perform the first computing task. Based on thefunction-associated keyword, one or more functions appearing in thesource code repository are determined to define and call to perform thefirst computing task. A custom code is generated, in the programminglanguage, which includes a declaration of the determined variables atthe variable-declaration entry, a definition of the determinedfunction(s) at the function-definition entry, and a call to thedetermined function(s) using the declared variables at the function-callentry.

This disclosure encompasses the recognition of previously unidentifiedproblems associated with previous technology used to maintaincollections of source code and adapting this source code to generatecode to perform a desired task or function. For instance, previousapproaches to storing source code generally relied on programmers tomanually annotate code with comments and save the code in a fashion thatallowed future use. However, different users tend to have differentapproaches to writing code in the programming language and formattingthe code, resulting in source code entries that may be of limited use toothers (i.e., because the purpose of the code is difficult or impossibleto decipher). Using previous technology, multiple copies of the same orsimilar source code may be stored that perform the same function,resulting in inefficient use of computing resources. Moreover, usingprevious technology, a preferred source code (e.g., a most efficientsource code, or a source code with a particular style or format) may notbe used as a starting point for generating new programming code becausethere was previously no means for identifying this preferred sourcecode. Previous technology also fails to detect and correct problematicsource code (e.g., whether the code is incorrectly formatted for a giventask, includes inefficient protocols, or is intentionally malicious).

Certain embodiments of the systems, methods, and device of thisdisclosure provide unique solutions to these newly recognized problemsdescribed above and other technical problems by facilitating thereliable storage of source code and the efficient generation of new,customized code. For example, the disclosed system provides severaltechnical advantages which include 1) automatic detection and correctionof any anomalies in the source code prior to its storage for future use;2) determination of natural language descriptions of source code (e.g.,of “stories”), which can be easily interpreted even without specializedknowledge and training in a programming language; 3) the efficient andreliable generation of new source code for a custom task and with auser-specific style; and 4) the provision of candidate source code to auser's query to perform a given task and/or for source code related to agiven entity or group with which the user is affiliated.

As such, the system described in this disclosure may improve thefunction of computer systems used to store source code for future useand generate new source code. The system may also or alternativelyreduce or eliminate practical and technical barriers to repurposingexisting source code for to perform new functions or tasks. The systemdescribed in this disclosure may particularly be integrated into apractical application for storing source code used to performcalculations using a first set of variables and/or functions, andautomatically repurposing this code to perform the same or similarcalculations using a second set of user-identified variables and/orfunctions without manually modifying the underlying programming languagein the source code (i.e., without writing any code in a specializedprogramming language).

Certain embodiments of this disclosure are related to a source codeanalyzer which determines whether newly provided code is appropriate forstorage and future use as source code. For instance, style features canbe extracted from the source code and used to identify anomalies inorder to detect unapproved or malicious source code. The source codeanalyzer may generate a repository of natural language descriptions ofsource code, or “stories,” which may include specialized badges, ortags, which link portions of the descriptions (and/or the associatedlines of the corresponding source code) to particular formulas, businessunits and the like. Examples of such embodiments are described belowwith respect to FIGS. 1-5 .

Certain embodiments of this disclosure are related to a custom codegenerator which uses natural language inputs (e.g., commands) and/orother queries from a user to generate custom code. Generated code can beautomatically customized according to the user input and adjusted tomatch a user's predetermined coding style (e.g., number and length ofcomments, spacing and indentation format, and the like). Examples ofsuch embodiments are described below with respect to FIGS. 1 and 6-7 .

Certain embodiments of this disclosure may include some, all, or none ofthese advantages. These advantages and other features will be moreclearly understood from the following detailed description taken inconjunction with the accompanying drawings and claims.

BRIEF DESCRIPTION OF THE DRAWINGS

For a more complete understanding of this disclosure, reference is nowmade to the following brief description, taken in connection with theaccompanying drawings and detailed description, wherein like referencenumerals represent like parts.

FIG. 1 is a schematic diagram of an example system for source codemaintenance and generation, according to an illustrative embodiment ofthis disclosure;

FIG. 2 is a flow diagram illustrating an example operation of the styleanalyzer of the system illustrated in FIG. 1 ;

FIG. 3 is a flow diagram illustrating the determination of codeanomalies;

FIG. 4 is a flowchart of a method for operating the story generator ofthe system illustrated in FIG. 1 ;

FIG. 5 illustrates example source code and example results generated atvarious steps of the method of FIG. 4 ;

FIG. 6 is a flowchart illustrating an example method of operating thecustom code generator of the system illustrated in FIG. 1 ;

FIG. 7 illustrates examples of various elements associated with steps ofthe method of FIG. 6 ; and

FIG. 8 is a diagram of an example device configured to implement thesystem of FIG. 1 .

DETAILED DESCRIPTION

As described above, prior to this disclosure, there was a lack of toolsfor reliably maintaining records of established source code andeffectively leveraging such records of source code to create new code toperform a desired task or function. Using previous technology, thegeneration of a new programming code based on stored source code istechnically challenging and inefficient. A user generally requiresspecialized knowledge of a particular programming language used to writethe code. Even with this knowledge, significant time can be expendedattempting to understand and successfully repurpose existing sourcecode. In many cases, in an effort to avoid these challenges, aprogrammer may create an all new code, effectively wasting the existingsource code (and the associated technical resources used to store andmaintain a record of source code).

Various embodiments of this disclosure may solve these and/or othertechnical problems associated with previous technology. For instance, incertain embodiments, this disclosure facilitates the efficientmaintenance of a source code repository and, optionally, a storyrepository, which stores natural-language descriptions of stored sourcecode (e.g., as described with respect to FIGS. 1-5 ). In certainembodiments, this disclosure includes a custom code generator whichfacilitates the generation of customized code in an efficient anduser-friendly manner (e.g., as described with respect to FIGS. 1 and 6-7)

As used in this disclosure, a natural language corresponds to a anestablished language (e.g., English) used for human-to-humancommunication. As used in the disclosure, a programming language refersto a formalized text-based language which includes instructions forimplementing functions and/or tasks using a computer. Examples ofprogramming languages include C, C++, C #, Python, JAVA, HTML, and thelike. These programming languages are provided for example only. Thisdisclosure contemplates the use of any programming language.

Source Code Maintenance and Generation System

FIG. 1 is a schematic diagram of an example system 100 for source codemaintenance and generation. The system 100 includes user devices 102a,b, a source code analyzer 106, a story repository 116, a source coderepository 122, a style repository 126, and a custom code generator 130.The source code analyzer 106 of system 100 is generally configured toreceive source code 108 from a particular user 104 a,b and detect anypossible anomalies in the source code 108 before the source code 108 isstored in the source code repository 122 (e.g., as stored source code124). For example, the style analyzer 114 may detect anomaliesassociated with style features in the source code 108, and, if ananomaly is detected, the source code 108 may be corrected prior to itsstorage in the source code repository 122. Further examples of theimplementation of the source code analyzer 106 are described below andwith respect to FIGS. 2-5 . The custom code generator 130 is generallyconfigured to receive a user input 132, which includes instructions forperforming desired computing tasks in a natural language, and generate acorresponding custom code 140 in an appropriate programming language forimplementing the task. Further examples of the implementation of thecustom code generator 130 are described below and with respect to FIGS.6 and 7 .

User devices 102 a,b are generally any computing devices operable toreceive user input associated with source code 108 and communicate thesource code 108 to the source code analyzer 106. For instance, a userdevice 102 a,b may include an appropriate interface and input device forinputting a source code 108. Source code 108 includes instructions in aprogramming language for performing a computing task (e.g., acalculation). In addition to instructions in a programming language,source code 108 may include comments which are written in a naturallanguage and provide context or a brief description of the purpose ofcertain lines or sections of the code 108. User devices 102 a,b may alsobe operable to provide a user input 132 and/or user query 134 to thecustom code generator 130. For example, each of the user devices 102 a,bmay be a computer or a mobile device. In the illustrative example ofFIG. 1 , device 102 a is associated with a first user 104 a, while userdevice 102 b is associated with a second user 104 b.

As described in greater detail below, whether source code 108 isprovided to the source code analyzer 106 by the first computing device102 a associated with the first user 104 a or the second computingdevice 102 b associated with the second user 104 b may determine how thesource code 108 is analyzed and subsequently stored in the source coderepository 122 (e.g. or prevented from being stored in the source coderepository 122). As also described in greater detail below, whether userinput 132 and/or query 134 is provided to the code generator 130 by thefirst computing device 102 a associated with a first user 104 a or thesecond computing device 102 b associated with a second user 104 b maydetermine how custom code 140 is generated (e.g., in an appropriateuser-specific fashion). Devices 102 a,b may be implemented using thehardware, memory, and interface of device 800 described with respect toFIG. 8 below

Source code analyzer 106 may be any computing device, or collection ofcomputing devices, configured to receive source code 108 from userdevices 102 a,b and analyze the source code 108. The source codeanalyzer 106 may be configured to review received source code 108,detect any anomalies in the source code, and correct the anomalies whenpossible/appropriate. The source code analyzer 106 may be implementedusing the hardware, memory, and interface of device 800 described withrespect to FIG. 8 below. In some embodiments, the source code analyzer106 may be implemented on a user device 102 a,b (e.g., using appropriateinstructions stored in a memory of the device 102 a,b and executed by aprocessor of the device 102 a,b). In other embodiments, the source codeanalyzer 106 may be implemented using a separate device, or a collectionof computing devices (e.g., configured as a server).

As illustrated in FIG. 1 , the source code analyzer 106 may include astory generator 110 and a style analyzer 114. The story generator 110generally determines, for the source code 108, a corresponding story112. The story 112 is a natural language description of instructionsincluded in the source code 108. The source code analyzer 106 may storethe story 112 in the story repository 116 (e.g., as one of the stories118). The generated story 112 is generally stored such that it isassociated with the source code 108. This allows the story 112 to bereviewed at a later time by a user 104 a,b and allows the user 104 a,bto identify the corresponding source code 108. In some embodiments, thestory 112 may be determined in a first language (e.g., English) andsubsequently translated to a more appropriate language for a given user104 a,b (e.g., a preferred language for the user 104 a,b). Exampleimplementation of the story generator 110 is described in greater detailbelow with respect to FIGS. 4-5 .

The style analyzer 114 generally determines style features of the sourcecode 108 and determines, based at least in part on these style features,whether to store the source code 108 in the source code repository 122,modify the source code 108 prior to its storage, or whether to preventstorage of the source code 108. For instance, the style analyzer 114 maydetect anomalies in style features of the source code 108 (e.g.,irregular use of comments, spaces, and/or punctuation in the source codeand/or in the comments, e.g., changes to language in the comments or tothe variable naming conventions). The style analyzer 114 mayautomatically edit the format of the source code 108 to correct theanomalies prior to storing the edited source code 108 in the source coderepository 122 (e.g., as an entry of stored source code 124). If theanomalies are severe, the style analyzer 114 may prevent storage of thesource code 108. In some cases, the style analyzer 114, rather thanpermanently preventing the storage of source code 108 with detectedanomaly(ies), the source code 108 may be flagged for human review, andthe source code may 108 may be prevented from being stored at leastuntil results of such a review are received. Examples of detectedanomalies include a length of indentations in the source code 108 thatis outside of a predefined range, location of gap lines (i.e., emptylines of code) in the source code 108 not conforming to predefinedconventions, a frequency of gap lines in the source code 108 that isoutside of a predefined range, a frequency and/or location ofpunctuation in the source code 108 that does not conform to predefinedconventions, a number of spaces following variables or other text in aline of the source code 108 that is outside a predefined range, and thelike.

In order to facilitate these and other functionalities of the styleanalyzer 114, the style analyzer 114 may determine and store styleprofiles 128 a,b for corresponding users 104 a,b in the style repository126. Style profiles 128 a,b generally store the predefined stylefeatures that have been determined for the corresponding users 104 a,b(e.g., based on previous code prepared by these users 104 a,b). Thestyle profiles 128 a,b may be used to aid in detecting anomalous sourcecode 108 (e.g., if source code 108 received from a given user 104 a,bdoes not include style features which correspond to those of that user'sstyle profile 128 a,b) and to generate custom code using the custom codegenerator 130 (described further below). Example implementation of thestyle analyzer 114 is described in greater detail below with respect toFIGS. 2-3 .

The story repository 116 is generally a data store, or database,configured to store stories 118 (e.g., natural-language descriptions ofthe source code 124 stored in the source code repository 122). Stories118 may include the story 112 generated for the source code 108 alongwith descriptions of other source code 124 previously received by thesource code analyzer 106, as described briefly above and in greaterdetail below with respect to FIGS. 4-5 . Each entry of source code 124may have a corresponding story 118 in the story repository 116. Thestory repository 116 may also store summaries 120 of the stories (e.g.,more succinct versions of the stories 118). This disclosure contemplatesstory repository 116 storing information (e.g., stories 118 and/orsummaries 120) arranged in any appropriate format. The story repository116 may be stored in memory of a dedicated device and/or in a memory ofone or more of the user devices 102 a,b, source code analyzer 106, andcustom code generator 130. The story repository 116 may be implementedusing the hardware, memory, and interface of device 800 described withrespect to FIG. 8 below.

The story repository 116 may provide further insights for improving theefficiency associated with storing source code 124 in the source coderepository 122. For instance, in some embodiments, source code 124 withthe same or similar stories 118, or summaries 120, may be associatedwith one another. Such related source code may be flagged for review toidentify differences in the source code 124 and/or determine a preferredentry of source code 124 to use in the future. For instance, a preferredcode 124 may be retained in the source code repository 122, while anon-preferred entry of source code 124 with the same or a similar story118 (e.g., less efficient code for performing the same task) may bediscarded.

The source code repository 122 is generally a data store, or database,configured to store source code 124. Source code 124 may include thesource code 108 as received or as-edited by the source code analyzer106, as described briefly above and in greater detail below with respectto FIG. 2-3 . The source code repository 122 also stores previouslyreceived source code 124. This disclosure contemplates source coderepository 122 storing information (e.g., source code 124) arranged inany appropriate format. The source code repository 122 may be stored inmemory of a dedicated device and/or in a memory of one or more of theuser devices 102 a,b, source code analyzer 106, and the custom codegenerator 130. The source code repository 122 may be implemented usingthe hardware, memory, and interface of device 800 described with respectto FIG. 8 below.

The style repository 126 is generally a data store, or database,configured to store style profiles 128 a,b for users 104 a,b. The stylerepository 126 may be implemented using the hardware, memory, andinterface of device 800 described with respect to FIG. 8 below. Eachstyle profile 128 a,b is generally associated with a corresponding user104 a,b and reflects the formatting conventions commonly used by theusers 104 a,b when writing in the programming language used to preparesource code 108. As such, each style profile 128 a,b generally includespredefined style features associated with how the users 104 a,b prepare(or are expected to prepare) source code 108. As a non-limiting example,the style profiles 128 a,b may store user-specific features such as thelength and/or frequency of indentations in the source code 108 by thecorresponding user 102 a,b when writing in the programming language,location of gap lines in source code 108, frequency of gap lines insource code 108 generated by the corresponding user 102 a,b when writingin the programming language, the frequency and/or location ofpunctuation (e.g., colons, semicolons) and/or use of capitalization incomments in the source code 108 by the corresponding user 102 a,b whenwriting in the programming language, the frequency and/or location ofcomments (e.g., before functions, after variable declarations), and anumber of gaps (i.e., empty lines) following a line in in the sourcecode 108 prepared by the corresponding user 102 a,b when writing in theprogramming language. The style profiles 128 a,b may also includethreshold ranges by which a style feature can differ from a predefinedstyle feature for the user 104 a,b before an anomaly is detected. Theimplementation of style profiles 128 a,b is described in greater detailwith respect to FIG. 3 below.

The style profiles 128 a,b may be determined using a number of sourcecode entries (e.g., stored as entries 124 in the source code repository122) prepared by the users 104 a,b over a period of time (e.g., weeks ormonths). For instance, the style profiles 128 a,b may be determinedusing a set of heuristics and/or using appropriate method of machinelearning. This disclosure contemplates style repository 126 storinginformation (e.g., style profiles 128 a,b) arranged in any appropriateformat. The style repository 126 may be stored in memory of a dedicateddevice and/or in a memory of one or more of the user devices 102 a,b,source code analyzer 106, and custom code generator 130.

The custom code generator 130 is generally configured to receive a userinput 132, which includes text in a natural language (e.g., English orany other appropriate language for the users 104 a,b), and generatecorresponding custom code 140. For instance, the user input 132 mayinclude a description of a computing task a user 104 a,b desires thesource code 140 to perform. The code writer 136 may use information inthe story repository 116 and/or the source code repository 122 toidentify and modify, as needed, portions of the stored source code 124to generate custom code 140. For example, the code writer 136 mayidentify keywords in the user input 132 that are linked with portions ofstories 118 and provide the corresponding source code 124 to the user104 a,b. As another example, if a portion of the user input 132 is thesame as, or similar to a portion of a story 118, the code writer 136 mayuse the source code 124 that corresponds to this portion of the story118 in order to write the custom code 140.

The custom code generator 130 may also include a style modifier 138,which is generally configured to edit (e.g., or “fix”) the style of codegenerated by the code writer 136 such that custom code 140 has a stylethat is aligned with the user's style profile 128 a,b. The stylemodifier 138 generally employs the style profiles 128 a,b to performsuch modifications. In some embodiments, the source code generator 130facilitates the efficient and reliable repurposing of stored source code124, which may be associated with a first task or function (e.g., forperforming calculations using a first set of variables and/or functionsassociated with a first entity or business unit), into a custom code140, which is configured for a different task or function (e.g., forperforming calculations using a second set of variables and/or functionsassociated with a second entity or business unit) without requiring anytechnical or programming expertise from the user 104 a,b who providedthe natural-language input 132. An example operation of the custom codegenerator is described in greater detail below with respect to FIG. 6 .The custom code generator 130 may be implemented using the hardware,memory, and interface of device 800 described with respect to FIG. 8below

In an example operation of the system 100, a user 104 a,b providessource code 108 to the source code analyzer 106 for storage in thesource code repository 122. The style analyzer 114 determines whetherthe source code 108 meets certain criteria for storing the source codein the source code repository 122. For instance, the style analyzer maydetermine whether style features of the source code 108 correspond tothe expected style features indicated by the user's style profile 128a,b. An example of this is described with respect to FIG. 3 below. Ifthe style features are not within an expected range, the code 108 may beedited so that the style of the code 108 is brought into accordance withthe user's style profile 128 a,b before the code 108 is stored in thesource code repository 122. In some cases, code 108 may be flagged forfurther review and storage of the code 108 may be prevented at least fora period of time (e.g., at least until results of administrator revieware received indicating the code 108 is approved for storage). In somecases, the source code analyzer 106 may also or alternatively determinea natural language description, or story 112, for the source code 108.The story 112 may be stored in the story repository 116 for future use,for example, by the custom code generator 130. Further examples of theoperation of the source code analyzer 106 are described below withrespect to FIGS. 2-5 .

In another example operation of the system 100, a natural-language userinput 132 is provided by a user 104 a,b to the custom code generator130. The code writer 136 may use stories 118 from the story repository116 and source code 124 from the source code repository 122 to generatecustom code 140, based on the user input 132. For instance, keywordsidentified in the user input 132 may be matched to those of the stories118. Source code 124 associated with the matching stories 118 may beappropriately combined to generate the custom code 140. In some cases,the style modifier 138 uses the style profiles 128 a,b to modify thestyle of the custom code 140 such that it matches a predefinedprogramming style for the user 104 a,b (e.g., in accordance with styleprofiles 128 a,b). In some cases the user input 132 may further includefeedback to the custom code generator 130, which may be used to improveperformance of the code writer 136 and/or style modifier 138. In somecases, a user 104 a,b may further edit the custom code 140 by providinga user query 134, which includes a search phrase or other request toidentify appropriate existing source code 124 to include in the customcode 140. Further examples of the operation of the custom code generator130 are described below with respect to FIGS. 6 and 7 .

Style Analyzer of the Source Code Analyzer

FIG. 2 shows a flow diagram 200 illustrating example operation of thestyle analyzer 114 of the source code analyzer 106. In this illustrativeexample, the style analyzer 114 receives previously stored code 202 aassociated with user 104 a and previously stored code 202 b associatedwith user 104 b. The previously stored code 202 a,b may be received fromthe source code repository (i.e., the code 202 a,b may be included inthe stored source code 124 of FIG. 1 ) Stored source code 202 a maycorrespond to a first set of source code (e.g., instructions written ina programming language) associated with (e.g., generated by) first user104 a of FIG. 1 , and stored source code 202 b may correspond to asecond set of source code (e.g., instructions written in a programminglanguage) associated with (e.g., generated by) second user 104 b of FIG.1 . The style analyzer 114 uses the previously stored code 202 a,b todetermine style profiles 128 a,b for the users 104 a,b. As explainedfurther below, these style profiles 128 a,b may be employed by the styleanalyzer 114 to evaluate new source code 204 a,b received from users 104a,b.

Following receipt of the stored code 202 a,b, style extraction 206 isperformed. Style extraction 206 generally involves the determination ofstyle features 210 a,b for the stored code 202 a,b associated with theusers 104 a,b. For example, style extraction 206 may involve determiningstyle features 210 a,b prevalent in (e.g., commonly found in) the sourcecode 202 a,b. As an example, the style features 210 a,b may include oneor more of a length of indentations in the source code 202 a,b, locationof gap lines (e.g., whether empty lines are left after comments, callsto functions, or the like) in the source code 202 a,b, a frequency ofgap lines (e.g., how frequently empty lines are found in) the sourcecode 202 a,b, a frequency and/or location of punctuation in the sourcecode 202 a,b (e.g., how often periods, commas, semicolons, and the likeappear in the source code 202 a,b and/or whether such punctuation iscommonly found in comments, calls to functions, following variables,etc.), and the like. The style features 210 a,b are not limited to theseexample features and may include any other appropriate featuresassociated with a format or style of source code 202 a,b.

Following style extraction 206, the style analyzer 114 proceeds tocreation 208 of style profiles 128 a,b. Profile creation 208 involvesassociating the determined style features 210 a,b with a user identifier212 a,b for the user 104 a,b who generated the associated stored code202 a,b. The style profiles 128 a,b are generally stored in the stylerepository 126, such that this information is available for future use,for example, by the style analyzer 114 and the custom code generator 130(see FIG. 1 ).

When new source code 204 a,b is received by the style analyzer 114, thestyle analyzer 114 may proceed with style extraction 206, similarly toas described above. For example, the style analyzer 114 may determinenew style features 210 a,b for the received source code 204 a,b. Thestyle analyzer 114 then makes a determination 214 of whether an anomalyis detected in the source code 204 a,b. The determination 214 may employmachine learning or artificial intelligence to determine whether the newcode 204 a,b has a style that corresponds to that of the appropriatestyle profile 128 a,b and can, thus, reliably be stored in the sourcecode repository 122. For example, a machine learning model may betrained based on the previous source code 202 a,b (i.e., and any otherappropriate source code 124 associated with the style profile 128 a,b).Also or alternatively determination 214 may involve one or moreheuristics or rules to determine if the new code 204 a,b has a stylethat corresponds to that of the appropriate style profile 128 a,b or ananomaly (e.g., a style anomaly) is detected.

FIG. 3 is a diagram 300 illustrating an example of anomaly determination214 in greater detail. As shown in FIG. 3 , a newly determined stylefeature 302 is compared to a corresponding predefined style feature 304.The determined style feature 302 may be any of the example stylefeatures 210 a,b described above, or any other appropriate featureassociated with the formatting of the new code 204 a,b. The predefinedstyle feature 304 may be one of the style features 210 a,b for the user104 a,b who provided the new source code 204 a,b being analyzed (seealso FIGS. 1 and 2 ).

A comparator 306 is used to compare the determined style feature 302 tothe corresponding predefined style feature 304 in order to determine afeature difference 308 (e.g., an extent to which the determined feature302 is different from the predefined style feature 304). The featuredifference 308 may correspond, for example, to a value by which anothervalue associated with the determined style feature 302 is different froma value associated with the predefined style feature 304. For instance,if the determined feature 302 indicates that the new code 204 a,bincludes zero gap lines (i.e., empty lines of the code 204 a,b) after acall to a function and the predefined style feature 304 indicates thatthe user 104 a,b who provided the new code 204 a,b typically includestwo gap lines after a call to a function, the comparator 306 maydetermine a difference 308 with a value of two (i.e., 2 expected gaplines−0 observed gap lines=2 gap lines).

The feature difference 308 is compared to a threshold range 310 via asecond comparator 312 to determine whether the difference 308 is withina threshold range 310. The threshold range 310 generally corresponds toan amount that the determined feature 302 can differ from the predefinedfeature 304. The threshold range 310 for a given feature type may bedifferent for each user 104 a,b (e.g., as determined by the styleprofiles 128 a,b). For instance, if the determined style feature 302indicates that the new code 204 a,b of FIG. 2 does not include any emptylines (i.e., “gap lines”) after a called function, and the correspondingpredefined feature 310 indicates that the user 104 a,b usually includestwo gap lines after each call to a function, the calculated difference308 is two (i.e., 2 gap lines−0 gap lines=2 gap lines), as described inthe example above. In this example, the threshold range 310 may be arange from negative one to positive one (i.e., indicating that anexpected number of gap lines for the user 104 a,b (e.g., as indicated bythe user's style profile 128 a,b) may be the value associated with thepredefined style feature 304 plus or minus one). In this example, thefeature difference 308 of two gap lines is not within the thresholdrange 310, and, therefore, the feature 302 fails to correspond to theuser's style profile 128 a,b, resulting in an anomaly determination 314that is positive.

If the feature difference 308 is within the threshold range 310, thecomparator 312 generally determines that the feature 302 has a negativeanomaly determination 314 (i.e., an anomaly is not detected for thefeature 302). A negative anomaly determination 314 generally indicatesthat the feature 302 is in agreement with the user's style profile 128a,b, and an anomaly is not detected at determination 214 of FIG. 2.However, if the feature difference 308 is not within the threshold range310, the anomaly determination 314 is positive, indicating that thefeature 302 is not in agreement with the user's style profile 128 a,b,and an anomaly is detected at determination 214 of FIG. 2 . In someembodiments, a plurality of features 302 for a given entry of new code204 a,b are evaluated according to the process illustrated in FIG. 3 .In such cases, at least a minimum number of features 302 must be withinthe threshold as determined by comparator 312 in order for an anomalynot to be detected at determination 214 of FIG. 2 . For example, atleast 80% of the features 302 may need to have a negative anomalydetermination 314 in order for an anomaly not to be detected atdetermination 214 of FIG. 2 . If fewer than the minimum number offeatures 302 has a negative anomaly determination 314, an anomaly isdetected at step 214 of FIG. 2 .

Referring again to FIG. 2 , if an anomaly is not detected atdetermination 214, the style analyzer 114 proceeds to storage 216 of thecode 204 a,b. The code 204 a,b is generally stored in the source coderepository 122 of FIG. 1 , for example, such that the new code 202 a,bis subsequently available to aid in the generation of custom code 140 bythe source code generator 130, as described in greater detail below.

In some embodiments, if an anomaly is detected at determination 214, thestyle analyzer 114 may provide an alert 218 indicating review of thecode 204 a,b is needed. For instance, having been determined to beanomalous, the code 204 a,b may be provided to an administrator forreview. The administrator may determine whether the code 204 a,b isacceptable (e.g., whether anomalies in the code 204 a,b are associatedwith malicious intent (not acceptable) or whether detected anomalies areassociated with error or some other non-malicious intent. The results220 of this review may be used to determine whether the style analyzer114 should proceed to prevention 222 of storage of the source code 204a,b or to editing 224 the source code 204 a,b. In other embodiments(e.g., if an alert 218 is not provided), the determination 214 mayprovide further instructions for determining if the code 204 a,b isacceptable at 220 for storage 226 after being edited 224 or if the styleanalyzer 114 should prevent 222 storage of the code 204 a,b.

If an anomaly was detected at determination 214 and the code isacceptable at 220, the style analyzer 114 may automatically edit (e.g.,“fix”) 224 the source code 204 a,b. For example, referring to theexample of FIG. 3 , if the determined feature difference 308 is outsideof the threshold range 310, the code 204 a,b may be edited such that thefeature difference 308 is brought back within the threshold range 310.For example, in the context of the example described above with respectto FIG. 3 , if the determined feature indicated the presence of zero gaplines after a function call and the corresponding predefined feature 304indicated two gap lines should follow a function call, the styleanalyzer 114 may modify 224 the code 204 a,b such that two gap lines areadded after a function call. The style analyzer 114 then stores 226 theedited code 204 a,b in the source code repository 122 (e.g., as an entryof the source code 124 of FIG. 1 ). In some embodiments (e.g., where analert 218 is not provided), the above-described edits 224 to the code204 a,b may be performed following a positive determination 214 of astyle anomaly (e.g., in response to determining that a determinedfeature difference 308 of FIG. 3 is outside the corresponding thresholdrange 310).

If an anomaly was detected at determination 214 and the code is notacceptable at 220 (e.g., in response to determining that a featuredifference 308 of FIG. 3 is not within the threshold range 310 indicatedby the user's style profile 128 a,b), the style analyzer 114 preventsstorage 222 of the first source code in the source code repository 122.In some embodiments (e.g., where an alert 218 is not provided), thestyle analyzer 114 may determine that prevention 222 of code storage isappropriate based on one or more of the number of style featuredifferences 308 of FIG. 3 that are not within the correspondingthreshold ranges 310, the extent to which one or more of the featuredifferences 308 depart from the corresponding acceptable thresholdranges 310, and the like. For instance, in some cases, at least twodetermined style features 302 of a given code 204 a,b must fail thecomparison performed by comparator 312 of FIG. 3 in order for the styleanalyzer 114 to automatically prevent storage 222 of the code 204 a,b.For example, both the number of gap lines following a call to functionand the length of comments may have to be outside a predefined range inorder for a positive anomaly determination 314 to be made. In somecases, a feature difference 308 of FIG. 3 must be outside thecorresponding threshold range 310 by a minimum amount in order toproceed to prevention 222 of storage of the code 204 a,b. For example,if the difference between a determined feature 302 and a predefinedfeature 304 is four (e.g., if a code 204 a,b included six gap linesfollowing a call to a function rather than the expected two gap linesfor that user 104 a,b), and the threshold range is from negative one toone, this example feature difference 308 of four would be outside thethreshold range 310 by greater than a minimum amount of three.

In some embodiments, the style analyzer 114 may detect entries of sourcecode 124 which have been intentionally altered (e.g., maliciouslyaltered) and stored in the source code repository 122. For instance, thestyle analyzer 114 may intermittently check the stored source code 124and identify inconsistencies or changes in the source code 124 overtime. For instance if a given entry of the stored source code 124 has noor less than a threshold number of anomalies (see FIG. 3 andcorresponding description above) at a first time stamp and an increasein anomalies is detected at a second time stamp after the first timestamp, the style analyzer 114 may flag this entry of source code 124 forfurther review. The style analyzer 114 may change a permission flag onthis entry of the source code 124 to prevent use of the code until ithas passed further review. For instance, an altered permission of thisentry of source code 124 may prevent the source code 124 from being usedby the custom code generator 130 (described in greater detail below).This may provide further improvements to the security and reliability ofthe stored source code 124.

In some cases, the style analyzer 114 may search for personalinformation that is included in the stored source code 124. Forinstance, the style analyzer 114 may search for and flag any personaluser information (e.g., user names, addresses, account numbers). Thisinformation may be automatically removed if not necessary forimplementation of the code 124. Also or alternatively, this informationmay be automatically anonymized to prevent its compromise. This mayprovide further improved data security to the source code analyzer 106of FIG. 1 .

In some embodiments, the style analyzer 114 may search for keywordsassociated with known problems in the source code 124. For instance, thestyle analyzer 114 may search predefined words and/or phrases such as“to do,” “fix me,” “please fix,” and the like. An administrator mayidentify such terms commonly used by users 104 a,b to identify that aportion of code 124 is not complete or requires attention. These termsmay be searched for, and any stored code 124 containing these terms maybe flagged for further review and/or correction. In some embodiments,the style analyzer 114 may detect unused and/or redundant objects orfunctions in stored source code 124. These unused and/or redundant itemsmay be automatically removed from the source code 124, thereby makingboth the source code repository 122 and the stored source code 124 moreefficient.

Story Generator of the Source Code Analyzer

FIG. 4 is a flowchart of an example method 400 of story generation. Thestory generator 110 may implement method 300 to generate the story 112of FIG. 1 . The method 400 generally facilitates the determination of acorresponding description, in a natural language, of the instructionsincluded in the source code 108 for performing a task or function andthe subsequent storage of this natural-language description, or story112, in the story repository 116.

Method 400 may begin at step 402 where source code 108 is received bythe story generator 110. For instance, a user 104 a,b may provide thesource code 108 to the source code analyzer 108, as described above withrespect to FIG. 1 . At step 404, the story generator 110 determines, foreach line of the source code 108, a badge associated with a programmingtask. For example, a badge may be associated with a description of theprogramming function associated with the line of the source code 108, orthe information included in the line of the source code 108.

For illustrative purposes, FIG. 5 shows an example code portion 502,which may be included in source code 108. Each line of code portion 502has a corresponding line description 504. For example, the comment atthe top of code portion 502 has a corresponding line description 504 of“Headline,” while the second comment in the code portion 502 has acorresponding line description 504 of “Comment Line.” At step 404 ofFIG. 4 , the story generator 110 determines these descriptions 504 anduses them to determine a corresponding intelligent badge 508 for eachline of the source code 108.

At step 406 functions appearing in the source code 108 are replaced withpredefined text which describes the functions. For instance, an equalsign, when used to define a variable value in the source code 108, maybe replaced with the text “is assigned as.” When an equal sign is usedas part of an arithmetic function (e.g., “out=x*y” in the example ofFIG. 5 ), the equal sign may be replaced with a phrase such as “iscalculated as,” “is computed as,” or the like. This facilitates thetransformation of otherwise abstract functions and arithmetic symbolsinto readily interpretable natural language. FIG. 5 illustrates exampleresults 506 of steps 404 and 406 of method 400, after the storygenerator 110 has determined intelligent badges 508 and replacedfunctions with corresponding text (e.g., “out=x*y” from code portion 502is replaced with “out is calculated as x multiplied to y” in results506). The intelligent badges 508 are illustrated in bold and italicfont.

Referring again to FIG. 4 , at step 408, the story generator 110replaces variable names with predefined variable text. As an example,FIG. 5 illustrates the results 516 of replacing variables 510, 512, 514with corresponding text 518, 520, 522 at step 408. For instance, step408 of FIG. 4 may involve replacing the “var_asset” variable 510 and“fee_rate” variable 512 in the code portion 502 with corresponding textdescriptions of “variable asset” 518 and “fee rate” 520, as shown in theprogression from results 506 to results 516 in FIG. 5 . As anotherexample, step 408 of FIG. 4 may involve embedding function definitionsinside the results of a called function and replacing variable nameswith descriptions of the variables. For instance, as illustrated in FIG.5 , “result=fee_calc(var_asset, fee_rate)” in results 506 is transformedinto “result is computed as variable asset multiplied to fee rate” inresults 516 of step 408.

At step 410, the story generator 110 removes the badges to generate anatural language story 112 for the original source code 108. FIG. 5illustrates the results 524 of step 410. Results 524 are an example of astory 112, or a portion of a story 112. In some cases, the badges 508are retained in the story (e.g., such that the results 516 are includedin the sty 112). In such cases, all of the results 124 (i.e., ratherthan only line 526) may be retained as the summaries 120. Retaining thebadges 508 in the story 112 may be beneficial for operation of thecustom code generator 130, because the badges 508 can be used to moreeffectively associate stories 118 to keywords in the user input 132 andfind appropriate stored source code 124 as a starting point forgenerating custom code 140, as described in greater detail below.

At step 412, the story generator 110 stores the resulting story 112 inthe story repository 116. As illustrated in FIG. 5 , in some cases, theresults 524 (e.g., the story 112) may include a summary portion 526,which may be stored as one of the summaries 120 of FIG. 1 . The summaryportion 526 generally provides a high level and readily searchableoverview of the function of the source code portion 502.

Custom Code Generator

As described above with respect to FIG. 1 the custom code generator 130facilitates the reliable and user-friendly generation of custom code 140based on natural language input 132. The custom code 140 may includeinstructions written in any appropriate programming language forperforming one or more user-desired tasks or functions. The user input132 generally involves little or no previous knowledge from the users104 a,b of the programming language of the custom code 140. In somecases, a user query 134 may be received by the custom code generator 136and used to identify stories 118 which are related to the query 134. Ifa user selects one of the identified stories 118, the stored source code124 that is associated with the selected story 118 may be provided tothe user 104 a,b. This may further facilitate the efficient generationof custom code 140 for performing desired computing tasks or functions.

FIG. 6 is a flowchart of an example method 600 of generating custom code140 using the custom code generator 130 of FIG. 1 . The method 600 maybe performed by the custom code generator 130 using the code writer 136and/or style modifier 138. The method 600 may begin at step 602 where anatural-language user input 132 is received by the custom code generator130. The input 132 generally includes a description of a computing taskor function which a user 104 a,b wishes to perform. The input 132 mayalso include an indication of a programming language in which togenerate the custom code 140. The custom code generator 130 may use anyappropriate natural language processing algorithm to process the userinput 132, split the input 132 into subsections (e.g., split paragraphsinto sentences or portions of sentences), and/or tag keywords in theinput 132. FIG. 7 illustrates a portion 702 of a natural language userinput 132. This example input portion 702 includes certain taggedkeywords and phrases 704, 706, 708, and 710, which are used by thecustom code generator 130 to generate custom code 140 using method 600.

Referring again to FIG. 6 , at step 604, the custom code generator 130may determine code-line entries to include in the custom code 140, basedon the received natural-language input 132. For instance, words,phrases, or combinations of both included in the user input 132 may beused to determine code-line entries which should be included in thecustom code 140. FIG. 7 illustrates example code-line entries 712 toinclude in a custom code 140 generated based on input portion 702. Thecode-line entries 712 include a headline entry 714, a variablesdeclaration entry 716, a function definition entry 718, and a functioncall entry 720.

For example, the custom code generator may include a headline entry 714in custom code 140 such that an initial comment line is provided thatdescribes the use and/or operation of the custom code 140. The customcode generator 130 may determine that variable declarations 714 shouldbe included based on the identification of keywords 706 and 708 (i.e.,“fees” and “variable assets”) in the input portion 702. Such keywords706 and 708 may be associated with predefined variables by the customcode generator 130. The custom code generator 130 may determine thatfunction definition 718 should be included based on the identificationof keywords 704 and 706 (i.e., “calculate” and “fees”). Verbs, such as“calculate,” appearing in the input portion 702 may be associated withfunctions used to perform actions associated the verbs (i.e.,calculations in this example). The custom code generator 130 maydetermine that a function-call entry 720 should be included in order toexecute the defined for the declared variables.

Referring again to FIG. 6 , at step 606, an intelligent badge isdetermined for each code-line entry determined from the user input 132.Examples of intelligent badges 308 are illustrated in FIG. 3 . FIG. 7also illustrates example badges included in each code-line entry 714,716, 718, 720. Badges may be used, for example, to more efficientlylocate related stories 118 in the story repository 116. At step 608,variable-related words or phrases are identified in the user input 132and used to determine appropriate variables variable values to use inthe custom code 140 being generated. For instance, the custom codegenerator 130 may access information stored in the story repository 116,the source code repository 122, and/or the style repository 126 todetermine appropriate variable names and values to include in the customcode 140. For instance, as illustrated in the example of FIG. 7 , the“variable asset” keyword 708 may be associated with a “var_asset”variable 722. The custom code generator 130 may further determine avariable value 724 of ten for the “var_asset” variable 722. The customcode generator 130 may determine a calculation 726 associated with the“fee” keyword 706. This calculation 726 includes a further “fee_rate”variable 728, which has an associated variable value 730 of fifteen. Thevalues 724 and 730 may be determined based on the user 104 a,b whoprovided the user input portion 702. For example, the tagged “my group”phrase 710 of input portion 702 may be used to associate the variables722 and 728 with the appropriate values 724 and 730 for the user 104 a,bor the user's group (e.g., an entity or business group with which theuser 104 a,b is associated).

Referring to FIG. 6 , at step 610, the custom code generator 130determines functions to provide in place of function-related textidentified in the user input 132. For instance, the source codegenerator 130 may identify certain words, phrases, or combinations ofthese in the user input 132 which are related to an established function(e.g., a function employed in any of the stored source code 124). As anon-limiting example, FIG. 7 illustrates, a determined calculation 726associated with the input portion 702. The resulting custom code portion732 (described further with respect to step 612 below) may includefunction-definition code 738 associated with the determined calculation726.

Referring to FIG. 6 , at step 612, custom code 140 is generated based onthe determined function(s), variable(s), and badge(s) of steps 606, 608,and 610. An example of a determined code portion 732 is illustrated inFIG. 7 . As shown in the example of FIG. 7 , the code portion 732includes a headline portion 734, a variable-declaration portion 736, thefunction-definition portion 738, and a function-call portion 740. Theheadline portion 734 is generally a summary of the operation or use ofthe code portion 732. The variable-declaration portion 736 defines thevalues of variables to include in the code portion 732. Thefunction-definition portion 738, as described above with respect to step610, defines calculations to include in the code portion 732 (i.e., thecalculation indicated by the input portion 702). The function-callportion 740 generally includes code for calling the defined function 738using the declared variables 736.

Referring to FIG. 6 , at step 614, the custom code generator 130 maydetermine whether the style of the custom code 140 being generatedshould be edited (or “fixed”) to correspond to an appropriate style forthe user 104 a,b who provided the user input 132 and/or to the group orentity with which the user 104 a,b is affiliated (e.g., the entityassociated with the tagged “my group” keyword 710 of the input portion702). For instance, the custom code generator 130 (e.g., the stylemodifier 138) may compare style features of the code 140 generated atstep 612 to predefined style features for the user 104 a,b (e.g., fromthe user's style profile 128 a,b). In some embodiments, step 614 mayinvolve the approach described above with respect to FIG. 3 . In suchembodiments, if a positive anomaly determination 314 is made (i.e., whenstyle features 302 of the custom code 140 do not correspond topredefined features 304), the custom code generator 130 proceeds to step616 to adjust the code 140. Otherwise, if a negative anomalydetermination 314 is made (i.e., when style features 302 of the customcode 140 correspond to predefined features 304), the custom codegenerator may proceed to step 618 without adjusting the custom code 140.

At step 616, the custom code generator 130 (e.g., the style modifier 138of the custom code generator 130) edits the custom code 140 generated atstep 612. The code 140 may be “fixed” such that the format or style ofthe code 140 is in accordance with the style profile 128 a,b of the user104 a,b who provided the user input 132 received at step 602. The styleis generally fixed by modifying the code 140 such that the stylefeatures are aligned with the user's predefined style features (e.g., asindicated by the user's style profile 128 a,b). An example of such anadjustment is described above with respect to element 224 of FIG. 2above. As a further example, FIG. 7 illustrates an example fixed codeportion 742 where the code 732 has been modified to include stylefeatures 744 and 746, which bring the style of code portion 742 intoaccordance with the expected style of the user 104 a,b who provided theuser input portion 702. Fixed code portion 742 includes additional gaplines 744 and an additional comment line 746 not found in the codeportion 732 generated at step 612.

Modifying or “fixing” code at step 616 may provide further improvementsto the performance and reliability of the custom code 140 generated bythe custom code generator 130, for example, by facilitating thegeneration of custom code 140 that is not only appropriate forperforming certain desired tasks but also that meets quality standardsassociated with the style, format, and presentation of the custom code140 (i.e., such that the custom code 140 is readable to appropriatelytrained programmers and can be trusted for use in future applications).Accordingly, custom code 140 may be particularly appropriate for storagein the source code repository 122 as an entry of the stored source code124, such that the code 140 can be used in the future and repurposed, asneeded, using the custom code generator 130.

At step 618, the custom code generator 130 may determine whether a userquery 134 is received. As described above, a user query 134 generallycorresponds to a request from the user 104 a,b to identify and view oruse an entry of stored source code 124. For instance, a user query 134may include a natural-language question or search phrase for locatingassociated source code 124. If a user query 134 is not received at step618, the custom code generator 130 provides, at step 626, the generatedcode 140 to the user 104 a,b who provided the user input 132. The user104 a,b may then use the custom code 140 as desired.

If a user query is received at step 618, the custom code generator 130may proceed to step 620 to identify one or more related stories 118 inthe story repository 116. For instance, the custom code generator 130may identify stories 118 with similar text to that of the user query134. This identification may be performed using any appropriatetext-based search algorithm. For instance, a keywords may be identifiedin the query 134, and stories 118 which include the same or associatedkeywords may identified and presented to the user 104 a,b. At step 622,the custom code generator 130 determines whether a user selection of oneor more of the presented stories 118 is received. If a user selection isnot received at step 622, the custom code generator 130 generallyproceeds to step 626. However, if a user selection is received at step622, the custom code generator 130 proceeds to step 624.

At step 624, the custom code generator 130 may append the source code124 corresponding to the selected story(ies) 118 to the custom sourcecode 140 and/or provide the source code 124 corresponding to theselected story(ies) 118 to the user 104 a,b who provided the user query134. In some embodiments, the custom code generator 130 may providesuggestions for preferred source code 124 to include in the custom code140. For instance, if a user query 134 involves a request to locatesource code 124 associated with two functions being performed in series,the source code generator 130 may suggest a single entry of source code124 which performs both functions in series as a preferred optioncompared to providing two separate entries of source code 124, whicheach perform only one of the desired functions. For instance, ratherthan providing a first entry of source code 124 for performing a firsttask and a second entry of source code 124 for performing a second task,the custom code generator 130 may instead only provide a preferred thirdentry of source code 124 the performs the first and second taskssequentially.

In some embodiments, the custom code generator 130 may identify existingsource code 124 for performing a desired task on a first set ofvariables (e.g., associated with a user input 132 and/or query 134) andrepurpose this source code 124 to perform the same desired task (e.g.,calculations) using a second set of variables which were identified inthe user input 132 and/or query 134. As an example, the code generator130 may receive a query 134 comprising a request to perform a computingtask using a first set of variables. The custom code generator 130 maythen identify (e.g., based on keywords identified in the query 134) astory 118 stored in the story repository 116, that is related toperforming the second computing task. The identified story 118 may bepresented to the user 104 a,b. If the user 104 a,b selected the story118, the source code 124 corresponding to the story may be determined.If the source code 124 performs the desired task using a different setof variables, the source code 124 may be edited to replace the differentset of variables with the set of variables indicated in the user query134.

At step 626, the custom code 140 (e.g., as optionally modified at step624) is provided to the user 104 a,b. The user 104 a,b may then use thecustom code 140 as appropriate.

Example Device

FIG. 8 is an embodiment of a device 800 configured to implement thequery generation system 100. The device 800 comprises a processor 802, amemory 804, and a network interface 806. The device 800 may beconfigured as shown or in any other suitable configuration. The device800 may be and/or may be used to implement computing devices 102 a,b,source code analyzer 106, story repository 116, source code repository122, style repository 126, and custom code generator 130 of FIG. 1 .

The processor 802 comprises one or more processors operably coupled tothe memory 804. The processor 802 is any electronic circuitry including,but not limited to, state machines, one or more central processing unit(CPU) chips, logic units, cores (e.g. a multi-core processor),field-programmable gate array (FPGAs), application specific integratedcircuits (ASICs), or digital signal processors (DSPs). The processor 802may be a programmable logic device, a microcontroller, a microprocessor,or any suitable combination of the preceding. The processor 802 iscommunicatively coupled to and in signal communication with the memory804 and the network interface 806. The one or more processors areconfigured to process data and may be implemented in hardware orsoftware. For example, the processor 802 may be 8-bit, 16-bit, 32-bit,64-bit or of any other suitable architecture. The processor 802 mayinclude an arithmetic logic unit (ALU) for performing arithmetic andlogic operations, processor registers that supply operands to the ALUand store the results of ALU operations, and a control unit that fetchesinstructions from memory and executes them by directing the coordinatedoperations of the ALU, registers and other components. The one or moreprocessors are configured to implement various instructions. Forexample, the one or more processors are configured to executeinstructions to implement the function disclosed herein, such as some orall of methods 400 and 600. In an embodiment, the function describedherein is implemented using logic units, FPGAs, ASICs, DSPs, or anyother suitable hardware or electronic circuitry.

The memory 804 is operable to store source code 108, 124, stories 118,summaries 120, style profiles 128 a,b, and any other data, instructions,logic, rules, or code operable to execute the function described herein.The memory 804 comprises one or more disks, tape drives, or solid-statedrives, and may be used as an over-flow data storage device, to storeprograms when such programs are selected for execution, and to storeinstructions and data that are read during program execution. The memory804 may be volatile or non-volatile and may comprise read-only memory(ROM), random-access memory (RAM), ternary content-addressable memory(TCAM), dynamic random-access memory (DRAM), and static random-accessmemory (SRAM).

The network interface 806 is configured to enable wired and/or wirelesscommunications. The network interface 806 is configured to communicatedata between the device 800 and other network devices, systems, ordomain(s). For example, the network interface 806 may comprise a WIFIinterface, a local area network (LAN) interface, a wide area network(WAN) interface, a modem, a switch, or a router. The processor 802 isconfigured to send and receive data using the network interface 806. Thenetwork interface 806 may be configured to use any suitable type ofcommunication protocol as would be appreciated by one of ordinary skillin the art.

While several embodiments have been provided in this disclosure, itshould be understood that the disclosed systems and methods might beembodied in many other specific forms without departing from the spiritor scope of this disclosure. The present examples are to be consideredas illustrative and not restrictive, and the intention is not to belimited to the details given herein. For example, the various elementsor components may be combined or integrated in another system or certainfeatures may be omitted, or not implemented.

In addition, techniques, systems, subsystems, and methods described andillustrated in the various embodiments as discrete or separate may becombined or integrated with other systems, modules, techniques, ormethods without departing from the scope of this disclosure. Other itemsshown or discussed as coupled or directly coupled or communicating witheach other may be indirectly coupled or communicating through someinterface, device, or intermediate component whether electrically,mechanically, or otherwise. Other examples of changes, substitutions,and alterations are ascertainable by one skilled in the art and could bemade without departing from the spirit and scope disclosed herein.

To aid the Patent Office, and any readers of any patent issued on thisapplication in interpreting the claims appended hereto, applicants notethat they do not intend any of the appended claims to invoke 35 U.S.C. §112(f) as it exists on the date of filing hereof unless the words “meansfor” or “step for” are explicitly used in the particular claim.

What is claimed is:
 1. A system comprising: a source code repositoryconfigured to store source code entries associated with a plurality ofusers, each source code entry comprising instructions in a programminglanguage for performing a computing task; and a code generatorcommunicatively coupled to the source code repository, the codegenerator comprising a processor configured to: receive an inputcomprising a request to perform a first computing task; identifykeywords in the input, the keywords comprising at least one firstkeyword and at least one second keyword; determine, based on theidentified keywords, code-line entries which, when executed in anordered combination, achieve the first computing task; determine, basedon the at least one first keyword, one or more variables appearing inthe source code entries of the source code repository to declare inorder to perform the first computing task; determine, based on the atleast one second keyword, one or more functions appearing in the sourcecode entries of the source code repository to define and call to performthe first computing task; generate custom code in the programminglanguage; determine style features of the generated custom code, thestyle features comprising formatting characteristics of the custom codethat are specific to a particular user, the determined style featurescomprising a first feature; and in response to determining that at leastthe first feature is outside a corresponding first threshold range of afirst predefined feature associated with the particular user,automatically edit the first feature such that the edited first featureis within the first threshold range of the first predefined featureassociated with the particular user; a style repository configured tostore a style profile for each of the plurality of users, each styleprofile comprising predefined style features, the predefined stylefeatures comprising formatting characteristics of the source codeentries of the source code repository prepared by the corresponding userof the plurality of users, wherein the first predefined featureassociated with the particular user is stored in the style repository;wherein the processor is further configured to determine whether thestyle features correspond to predefined style features associated withthe particular user by: determining a second feature of the custom code;comparing the second feature to a corresponding second predefinedfeature of the predefined style features; determining, based on secondresults of the comparison of the second feature to the correspondingsecond predefined feature, that the second feature is within a secondthreshold range of the second predefined feature; determining a thirdfeature of the custom code; comparing the third feature to acorresponding third predefined feature of the predefined style features;determining, based on third results of the comparison of the thirdfeature to the corresponding third predefined feature, that the thirdfeature is within a third threshold range of the third predefinedfeature; in response to determining that both the second feature iswithin the corresponding second threshold range of the second predefinedfeature and the third feature is within the corresponding thirdthreshold range of the third predefined feature, determining that thestyle features correspond to predefined style features associated with afirst style profile; and in response to determining that at least one ofthe second feature is outside the corresponding second threshold rangeof the second predefined feature and the third feature is outside thecorresponding third threshold range of the third predefined feature,determining that the style features do not correspond to the predefinedstyle features associated with the first style profile.
 2. The system ofclaim 1, wherein the processor is further configured to: determine thatthe style features do not correspond to predefined style featuresindicated by a first style profile associated with the particular user;and in response to determining that the style features do not correspondto the predefined style features indicated by the first style profileassociated with the particular user, automatically edit the custom codesuch that the style features correspond to the predefined style featuresindicated by the first style profile associated with the particularuser.
 3. The system of claim 1, wherein the processor is furtherconfigured to: after automatically editing the first feature such thatthe edited first feature is within the first threshold range of thefirst predefined feature, provide the custom code with the edited firstfeature to the particular user.
 4. The system of claim 1, furthercomprising: a story repository configured to store natural-languagedescriptions of the source code entries stored in the source coderepository; and the code generator communicatively coupled to the storyrepository, the processor further configured to: identify, based on thekeywords identified in the input, a first natural-language descriptionstored in the story repository, wherein the first natural-languagedescription is related to performing the first computing task; determinea first source code entry stored in the source code repository that isassociated with the identified first natural-language description,wherein the first source code entry comprises instructions, in theprogramming language, for performing the first computing task; andinclude at least a portion of the determined first source code entry inthe custom code.
 5. The system of claim 1, further comprising: a storyrepository configured to store natural-language descriptions of thesource code entries stored in the source code repository; and the codegenerator communicatively coupled to the story repository, the processorfurther configured to: receive a user query comprising a request toperform a second computing task using a first set of variables;identify, based on keywords identified in the user query, a firstnatural-language description stored in the story repository, wherein thefirst natural-language description is related to performing the secondcomputing task; present the first natural-language description to theparticular user; receive a selection of the first natural-languagedescription from the particular user; determine a first source codeentry stored in the source code repository that is associated with thefirst natural-language description, wherein the first source code entrycomprises instructions, in the programming language, for performing thesecond computing task using a second set of variables; edit the firstsource code entry by replacing the second set of variables with thefirst set of variables; and provide the edited first source code entryto the particular user.
 6. The system of claim 1, further comprising: astory repository configured to store natural-language descriptions ofthe source code entries stored in the source code repository; and thecode generator communicatively coupled to the story repository, theprocessor further configured to: receive a user query comprising arequest to perform, sequentially, an initial computing task followed bya subsequent computing task; identify, based on keywords identified inthe user query, a first natural-language description stored in the storyrepository associated with performing the initial computing task;identify, based on keywords identified in the user query, a secondnatural-language description stored in the story repository associatedwith performing the subsequent computing task; identify, based onkeywords identified in the user query, a third natural-languagedescription stored in the story repository associated with sequentiallyperforming the initial computing task followed by the subsequentcomputing task; present only the third natural-language description tothe particular user for selection; and in response to receiving aselection of the third natural-language description from the particularuser, provide a first source code entry associated with the thirdnatural-language description to the particular user.
 7. A methodcomprising: receiving an input comprising a request to perform a firstcomputing task; identifying keywords in the input, the keywordscomprising at least one first keyword and at least one second keyword;determining, based on the identified keywords, code-line entries which,when executed in an ordered combination, achieve the first computingtask; determining, based on the at least one first keyword, one or morevariables appearing in source code entries stored in a source coderepository to declare in order to perform the first computing task,wherein the source code repository is configured to store the sourcecode entries and each source code entry comprises instructions in aprogramming language for performing a computing task; determining, basedon the at least one second key word, one or more functions appearing inthe source code entries of the source code repository to define and callto perform the first computing task; generating custom code in theprogramming language; determining style features of the generated customcode, the style features comprising formatting characteristics of thecustom code that are specific to a particular user, the determined stylefeatures comprising a first feature; and in response to determining thatat least the first feature is outside a corresponding first thresholdrange of a first predefined feature associated with the particular user,automatically editing the first feature such that the edited firstfeature is within the first threshold range of the first predefinedfeature associated with the particular user; determining whether thestyle features correspond to predefined style features associated withthe particular user by: determining a second feature of the custom code;comparing the second feature to a corresponding second predefinedfeature of the predefined style features; determining, based on secondresults of the comparison of the second feature to the correspondingsecond predefined feature, that the second feature is within a secondthreshold range of the second predefined feature; determining a thirdfeature of the custom code; comparing the third feature to acorresponding third predefined feature of the predefined style features;determining, based on third results of the comparison of the thirdfeature to the corresponding third predefined feature, that the thirdfeature is within a third threshold range of the third predefinedfeature; in response to determining that both the second feature iswithin the corresponding second threshold range of the second predefinedfeature and the third feature is within the corresponding thirdthreshold range of the third predefined feature, determining that thestyle features correspond to predefined style features associated with afirst style profile; and in response to determining that at least one ofthe second feature is outside the corresponding second threshold rangeof the second predefined feature and the third feature is outside thecorresponding third threshold range of the third predefined feature,determining that the style features do not correspond to the predefinedstyle features associated with the first style profile.
 8. The method ofclaim 7, further comprising: determining that the style features do notcorrespond to predefined style features associated with the particularuser, wherein the first style profile is stored in a style repository,wherein the style repository is configured to store a style profile foreach of the plurality of users, each style profile comprising predefinedstyle features, the predefined style features comprising formattingcharacteristics of the source code entries of the source code repositoryprepared by the corresponding user of the plurality of users, whereinthe first predefined feature associated with the particular user isstored in the style repository; and in response to determining that thestyle features do not correspond to the predefined style featuresassociated with the particular user, automatically editing the customcode such that the style features correspond to the predefined stylefeatures associated with the particular user.
 9. The method of claim 7,further comprising: after automatically editing the first feature suchthat the edited first feature is within the first threshold range of thefirst predefined feature, providing the custom code with the editedfirst feature to the particular user.
 10. The method of claim 7, furthercomprising: identifying, based on the keywords identified in the input,a first natural-language description stored in a story repository,wherein the first natural-language description is related to performingthe first computing task, wherein the story repository is configured tostore natural-language descriptions of the source code entries stored inthe source code repository; determining a first source code entry storedin the source code repository that is associated with the identifiedfirst natural-language description, wherein the first source code entrycomprises instructions, in the programming language, for performing thefirst computing task; and including at least a portion of the determinedfirst source code entry in the custom code.
 11. The method of claim 7,further comprising: receiving a user query comprising a request toperform a second computing task using a first set of variables;identifying, based on keywords identified in the user query, a firstnatural-language description stored in a story repository, wherein thefirst natural-language description is related to performing the secondcomputing task, wherein the story repository is configured to storenatural-language descriptions of the source code entries stored in thesource code repository; presenting the first natural-languagedescription to the particular user; receiving a selection of the firstnatural-language description from the particular user; determining afirst source code entry stored in the source code repository that isassociated with the first natural-language description, wherein thefirst source code entry comprises instructions, in the programminglanguage, for performing the second computing task using a second set ofvariables; editing the first source code entry by replacing the secondset of variables with the first set of variables; and providing theedited first source code entry to the particular user.
 12. The method ofclaim 7, further comprising: receiving a user query comprising a requestto perform, sequentially, an initial computing task followed by asubsequent computing task; identifying, based on keywords identified inthe user query, a first natural-language description stored in a storyrepository associated with performing the initial computing task,wherein the story repository is configured to store natural-languagedescriptions of the source code entries stored in the source coderepository; identifying, based on keywords identified in the user query,a second natural-language description stored in the story repositoryassociated with performing the subsequent computing task; identifying,based on keywords identified in the user query, a third natural-languagedescription stored in the story repository associated with sequentiallyperforming the initial computing task followed by the subsequentcomputing task; presenting only the third natural-language descriptionto the particular user for selection; and in response to receiving aselection of the third natural-language description from the particularuser, providing a first source code entry associated with the thirdnatural-language description to the particular user.
 13. A device,comprising: a memory configured to store: a source code repositorycomprising source code entries associated with a plurality of users,each source code entry comprising instructions in a programming languagefor performing a computing task; and a style repository comprising astyle profile for each of the plurality of users, each style profilecomprising predefined style features, the predefined style featurescomprising formatting characteristics of the source code entries of thesource code repository prepared by the corresponding user of theplurality of users, wherein a first predefined feature associated with aparticular user is stored in the style repository; and a hardwareprocessor communicatively coupled to the memory, the hardware processorconfigured to: receive an input comprising a request to perform a firstcomputing task; identify keywords in the input, the keywords comprisingat least one first keyword and at least one second keyword; determine,based on the identified keywords, code-line entries which, when executedin an ordered combination, achieve the first computing task; determine,based on the at least one first keyword, one or more variables appearingin the source code entries of the source code repository to declare inorder to perform the first computing task; determine, based on the atleast one second keyword, one or more functions appearing in the sourcecode entries of the source code repository to define and call to performthe first computing task; generate custom code in the programminglanguage; determine style features of the generated custom code, thestyle features comprising formatting characteristics of the custom codethat are specific to a particular user, the determined style featurescomprising a first feature; and in response to determining that at leastthe first feature is outside a corresponding first threshold range ofthe first predefined feature associated with the particular user,automatically edit the first feature such that the edited first featureis within the first threshold range of the first predefined featureassociated with the particular user; determine whether the stylefeatures correspond to predefined style features associated with theparticular user by: determining a second feature of the custom code;comparing the second feature to a corresponding second predefinedfeature of the predefined style features; determining, based on secondresults of the comparison of the second feature to the correspondingsecond predefined feature, that the second feature is within a secondthreshold range of the second predefined feature; determining a thirdfeature of the custom code; comparing the third feature to acorresponding third predefined feature of the predefined style features;determining, based on third results of the comparison of the thirdfeature to the corresponding third predefined feature, that the thirdfeature is within a third threshold range of the third predefinedfeature; in response to determining that both the second feature iswithin the corresponding second threshold range of the second predefinedfeature and the third feature is within the corresponding thirdthreshold range of the third predefined feature, determining that thestyle features correspond to predefined style features associated with afirst style profile; and in response to determining that at least one ofthe second feature is outside the corresponding second threshold rangeof the second predefined feature and the third feature is outside thecorresponding third threshold range of the third predefined feature,determining that the style features do not correspond to the predefinedstyle features associated with the first style profile.
 14. The deviceof claim 13, wherein the processor is further configured to: determinethat the style features do not correspond to predefined style featuresindicated by a first style profile associated with the particular user;and in response to determining that the style features do not correspondto the predefined style features indicated by the first style profileassociated with the particular user, automatically edit the custom codesuch that the style features correspond to the predefined style featuresindicated by the first style profile associated with the particularuser.
 15. The device of claim 13, wherein the processor is furtherconfigured to: after automatically editing the first feature such thatthe edited first feature is within the first threshold range of thefirst predefined feature, provide the custom code with the edited firstfeature to the particular user.
 16. The device of claim 13, wherein thememory is further configured to store a story repository comprisingnatural-language descriptions of the source code entries stored in thesource code repository; and the processor is further configured to:identify, based on the keywords identified in the input, a firstnatural-language description stored in the story repository, wherein thefirst natural-language description is related to performing the firstcomputing task; determine a first source code entry stored in the sourcecode repository that is associated with the identified firstnatural-language description, wherein the first source code entrycomprises instructions, in the programming language, for performing thefirst computing task; and include at least a portion of the determinedfirst source code entry in the custom code.
 17. The device of claim 13,wherein the memory is further configured to store a story repositorycomprising natural-language descriptions of the source code entriesstored in the source code repository; and the processor is furtherconfigured to: receive a user query comprising a request to perform asecond computing task using a first set of variables; identify, based onkeywords identified in the user query, a first natural-languagedescription stored in the story repository, wherein the firstnatural-language description is related to performing the secondcomputing task; present the first natural-language description to theparticular user; receive a selection of the first natural-languagedescription from the particular user; determine a first source codeentry stored in the source code repository that is associated with thefirst natural-language description, wherein the first source code entrycomprises instructions, in the programming language, for performing thesecond computing task using a second set of variables; edit the firstsource code entry by replacing the second set of variables with thefirst set of variables; and provide the edited first source code entryto the particular user.